package cn.genmer.test.security.designpatterns.singleton;

/**
 * @program: concurrency_practice
 * @description: 懒汉式（线程不安全，同步代码块）- 不可用
 * @author: Genmer
 * @create: 2020-10-21 01:04
 **/
public class Singleton5 {
    // 构造方法和对象都是私有的
    private  static Singleton5 INSTANCE;

    // 这方式构造方法内容
    private Singleton5(){}

    public static  Singleton5 getInstance(){
        if (INSTANCE == null){
           synchronized (Singleton5.class){
               INSTANCE = new Singleton5();
           }
        }
        return INSTANCE;
    }
}
